home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / plotting / gnuplot3.lzh / gnuplot / bitmap.c next >
C/C++ Source or Header  |  1991-07-18  |  52KB  |  1,058 lines

  1. /* GNUPLOT - bitmap.c */
  2. /*
  3.  * Copyright (C) 1986, 1987, 1990, 1991   Thomas Williams, Colin Kelley
  4.  *
  5.  * Permission to use, copy, and distribute this software and its
  6.  * documentation for any purpose with or without fee is hereby granted, 
  7.  * provided that the above copyright notice appear in all copies and 
  8.  * that both that copyright notice and this permission notice appear 
  9.  * in supporting documentation.
  10.  *
  11.  * Permission to modify the software is granted, but not the right to
  12.  * distribute the modified code.  Modifications are to be distributed 
  13.  * as patches to released version.
  14.  *  
  15.  * This software is provided "as is" without express or implied warranty.
  16.  * 
  17.  *
  18.  * AUTHORS
  19.  * 
  20.  *   Original Software:
  21.  *     Jyrki Yli-Nokari <jty@intrin.UUCP>
  22.  *     Ronald J. Hartranft <rjh2@ns.cc.lehigh.edu>
  23.  *     Russell Lang <rjl@monu1.cc.monash.edu.au>
  24.  * 
  25.  * Send your comments or suggestions to 
  26.  *  pixar!info-gnuplot@sun.com.
  27.  * This is a mailing list; to join it send a note to 
  28.  *  pixar!info-gnuplot-request@sun.com.  
  29.  * Send bug reports to
  30.  *  pixar!bug-gnuplot@sun.com.
  31.  */
  32.  
  33. /*
  34. ** General raster plotting routines.
  35. ** Raster routines written and copyrighted 1987 by
  36. ** Jyrki Yli-Nokari (jty@intrin.UUCP)
  37. ** Intrinsic, Ltd.
  38. **
  39. ** You may use this code for anything you like as long as
  40. ** you are not selling it and the credit is given and
  41. ** this message retained.
  42. **
  43. */
  44.  
  45. /* Bitmap plotting routines derived from above raster plotting routines
  46.  * Russell Lang, 1990
  47.  */
  48.  
  49. #include <stdio.h>
  50. #include "plot.h"
  51. #include "bitmap.h"
  52.  
  53. bitmap *b_p = (bitmap *)NULL;    /* global pointer to bitmap */
  54. unsigned int b_currx, b_curry;    /* the current coordinates */
  55. unsigned int b_xsize, b_ysize;    /* the size of the bitmap */
  56. unsigned int b_planes;            /* number of color planes */
  57. unsigned int b_psize;            /* size of each plane */
  58. unsigned int b_rastermode;        /* raster mode rotates -90deg */
  59. unsigned int b_linemask = 0xffff;    /* 16 bit mask for dotted lines */
  60. unsigned int b_value = 1;        /* colour of lines */
  61. unsigned int b_hchar;            /* width of characters */
  62. unsigned int b_hbits;            /* actual bits in char horizontally */
  63. unsigned int b_vchar;            /* height of characters */
  64. unsigned int b_vbits;            /* actual bits in char vertically */
  65. unsigned int b_angle;            /* rotation of text */
  66. char_box b_font[FNT_CHARS];        /* the current font */
  67. unsigned int b_pattern[] = {0xffff, 0x1111,
  68.     0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
  69. int b_maskcount = 0;
  70. unsigned int b_lastx, b_lasty;    /* last pixel set - used by b_line */
  71.  
  72. #define IN(i,size)  ((unsigned)i < (unsigned)size)
  73.  
  74. /* 5x9 font, bottom row first, left pixel in lsb */
  75. char_row fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
  76.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000},
  77.   /*!*/  {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
  78.   /*"*/  {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
  79.   /*#*/  {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
  80.   /*$*/  {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
  81.   /*%*/  {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
  82.   /*&*/  {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
  83.   /*'*/  {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
  84.   /*(*/  {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
  85.   /*)*/  {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
  86.   /***/  {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
  87.   /*+*/  {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
  88.   /*,*/  {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
  89.   /*-*/  {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
  90.   /*.*/  {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
  91.   /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
  92.   /*0*/  {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
  93.   /*1*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
  94.   /*2*/  {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
  95.   /*3*/  {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
  96.   /*4*/  {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
  97.   /*5*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
  98.   /*6*/  {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
  99.   /*7*/  {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  100.   /*8*/  {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
  101.   /*9*/  {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
  102.   /*:*/  {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
  103.   /*;*/  {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
  104.   /*<*/  {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
  105.   /*=*/  {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
  106.   /*>*/  {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
  107.   /*?*/  {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
  108.   /*@*/  {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
  109.   /*A*/  {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
  110.   /*B*/  {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
  111.   /*C*/  {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
  112.   /*D*/  {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
  113.   /*E*/  {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  114.   /*F*/  {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  115.   /*G*/  {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
  116.   /*H*/  {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
  117.   /*I*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
  118.   /*J*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
  119.   /*K*/  {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
  120.   /*L*/  {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  121.   /*M*/  {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
  122.   /*N*/  {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
  123.   /*O*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
  124.   /*P*/  {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
  125.   /*Q*/  {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
  126.   /*R*/  {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
  127.   /*S*/  {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
  128.   /*T*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
  129.   /*U*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
  130.   /*V*/  {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
  131.   /*W*/  {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
  132.   /*X*/  {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
  133.   /*Y*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
  134.   /*Z*/  {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  135.   /*[*/  {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
  136.   /*\*/  {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
  137.   /*]*/  {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
  138.   /*^*/  {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
  139.   /*_*/  {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
  140.   /*`*/  {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
  141.   /*a*/  {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
  142.   /*b*/  {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
  143.   /*c*/  {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
  144.   /*d*/  {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
  145.   /*e*/  {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
  146.   /*f*/  {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
  147.   /*g*/  {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  148.   /*h*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
  149.   /*i*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
  150.   /*j*/  {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
  151.   /*k*/  {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
  152.   /*l*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
  153.   /*m*/  {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
  154.   /*n*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
  155.   /*o*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
  156.   /*p*/  {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
  157.   /*q*/  {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  158.   /*r*/  {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
  159.   /*s*/  {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
  160.   /*t*/  {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
  161.   /*u*/  {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
  162.   /*v*/  {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
  163.   /*w*/  {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
  164.   /*x*/  {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
  165.   /*y*/  {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
  166.   /*z*/  {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
  167.   /*{*/  {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
  168.   /*|*/  {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
  169.   /*}*/  {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
  170.   /*~*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
  171.   /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
  172. };
  173.  
  174. /* 9x17 font, bottom row first, left pixel in lsb */
  175. char_row fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
  176.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  177.           000000,000000,000000,000000,000000,000000,000000,000000},
  178.   /*!*/  {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
  179.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
  180.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  181.           000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
  182.   /*#*/  {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
  183.           0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
  184.   /*$*/  {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
  185.           0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
  186.   /*%*/  {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
  187.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
  188.   /*&*/  {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
  189.           0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
  190.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  191.           000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
  192.   /*(*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
  193.           0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
  194.   /*)*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
  195.           0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
  196.   /***/  {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
  197.           0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
  198.   /*+*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
  199.           0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
  200.   /*,*/  {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
  201.           000000,000000,000000,000000,000000,000000,000000,000000},
  202.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  203.           000000,0x01ff,000000,000000,000000,000000,000000,000000},
  204.   /*.*/  {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
  205.           000000,000000,000000,000000,000000,000000,000000,000000},
  206.   /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
  207.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
  208.   /*0*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
  209.           0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
  210.   /*1*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  211.           0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
  212.   /*2*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  213.           0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  214.   /*3*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  215.           0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  216.   /*4*/  {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
  217.           0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
  218.   /*5*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  219.           0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
  220.   /*6*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  221.           0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
  222.   /*7*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
  223.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
  224.   /*8*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  225.           0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
  226.   /*9*/  {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
  227.           0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
  228.   /*:*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
  229.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  230.   /*;*/  {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
  231.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  232.   /*<*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
  233.           0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
  234.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
  235.           000000,000000,000000,0x01ff,000000,000000,000000,000000},
  236.   /*>*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
  237.           0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
  238.   /*?*/  {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
  239.           0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  240.   /*@*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
  241.           0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
  242.   /*A*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
  243.           0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
  244.   /*B*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  245.           0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
  246.   /*C*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  247.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
  248.   /*D*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  249.           0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
  250.   /*E*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  251.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  252.   /*F*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  253.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  254.   /*G*/  {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
  255.           0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
  256.   /*H*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  257.           0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  258.   /*I*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  259.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
  260.   /*J*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  261.           0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
  262.   /*K*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  263.           0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
  264.   /*L*/  {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
  265.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  266.   /*M*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  267.           0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
  268.   /*N*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
  269.           0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
  270.   /*O*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  271.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  272.   /*P*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  273.           0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  274.   /*Q*/  {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
  275.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  276.   /*R*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  277.           0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  278.   /*S*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  279.           0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
  280.   /*T*/  {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
  281.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
  282.   /*U*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  283.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  284.   /*V*/  {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
  285.           0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
  286.   /*W*/  {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
  287.           0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  288.   /*X*/  {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
  289.           0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  290.   /*Y*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  291.           0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  292.   /*Z*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
  293.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
  294.   /*[*/  {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
  295.           0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
  296.   /*\*/  {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
  297.           0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
  298.   /*]*/  {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
  299.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
  300.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  301.           000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
  302.   /*_*/  {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
  303.           000000,000000,000000,000000,000000,000000,000000,000000},
  304.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  305.           000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
  306.   /*a*/  {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
  307.           0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
  308.   /*b*/  {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
  309.           0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
  310.   /*c*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  311.           0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  312.   /*d*/  {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
  313.           0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
  314.   /*e*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
  315.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  316.   /*f*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  317.           0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
  318.   /*g*/  {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  319.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  320.   /*h*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  321.           0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
  322.   /*i*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  323.           0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
  324.   /*j*/  {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
  325.           0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
  326.   /*k*/  {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
  327.           0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
  328.   /*l*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  329.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
  330.   /*m*/  {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
  331.           0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
  332.   /*n*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  333.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  334.   /*o*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  335.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  336.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
  337.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  338.   /*q*/  {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  339.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  340.   /*r*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  341.           0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
  342.   /*s*/  {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
  343.           0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
  344.   /*t*/  {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
  345.           0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
  346.   /*u*/  {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
  347.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  348.   /*v*/  {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
  349.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  350.   /*w*/  {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
  351.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  352.   /*x*/  {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
  353.           0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
  354.   /*y*/  {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
  355.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  356.   /*z*/  {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
  357.           0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
  358.   /*{*/  {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
  359.           0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
  360.   /*|*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  361.           000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
  362.   /*}*/  {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
  363.           0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
  364.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  365.           000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
  366.   /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
  367.           000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
  368. };
  369.  
  370. /* 13x25 font, bottom row first, left pixel in lsb */
  371. char_row fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
  372.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  373.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  374.           000000,000000,000000,000000,000000,000000,000000},
  375.   /*!*/  {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
  376.           000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
  377.           0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
  378.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  379.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  380.           0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  381.   /*#*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
  382.           0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
  383.           0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  384.   /*$*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  385.           0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
  386.           0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
  387.   /*%*/  {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
  388.           0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  389.           0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
  390.   /*&*/  {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
  391.           0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
  392.           0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
  393.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  394.           000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
  395.           0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
  396.   /*(*/  {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
  397.           0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
  398.           0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
  399.   /*)*/  {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
  400.           0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
  401.           0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
  402.   /***/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  403.           0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
  404.           0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
  405.   /*+*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  406.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
  407.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
  408.   /*,*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  409.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  410.           000000,000000,000000,000000,000000,000000,000000},
  411.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  412.           000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  413.           000000,000000,000000,000000,000000,000000,000000},
  414.   /*.*/  {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
  415.           0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
  416.           000000,000000,000000,000000,000000,000000,000000},
  417.   /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
  418.           0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  419.           0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
  420.   /*0*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  421.           0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
  422.           0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
  423.   /*1*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  424.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  425.           0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
  426.   /*2*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  427.           0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
  428.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  429.   /*3*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  430.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
  431.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  432.   /*4*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
  433.           0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
  434.           0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
  435.   /*5*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  436.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
  437.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  438.   /*6*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  439.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
  440.           0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
  441.   /*7*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  442.           0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  443.           0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
  444.   /*8*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  445.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
  446.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  447.   /*9*/  {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
  448.           0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
  449.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  450.   /*:*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
  451.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  452.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  453.   /*;*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  454.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  455.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  456.   /*<*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
  457.           0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
  458.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
  459.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  460.           000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
  461.           0x1fff,000000,000000,000000,000000,000000,000000},
  462.   /*>*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
  463.           0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
  464.           0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
  465.   /*?*/  {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
  466.           000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  467.           0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
  468.   /*@*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
  469.           0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
  470.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  471.   /*A*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  472.           0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
  473.           0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
  474.   /*B*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  475.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
  476.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  477.   /*C*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  478.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  479.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  480.   /*D*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  481.           0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
  482.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  483.   /*E*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  484.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  485.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  486.   /*F*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  487.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  488.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  489.   /*G*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
  490.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
  491.           0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
  492.   /*H*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  493.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
  494.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  495.   /*I*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  496.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  497.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
  498.   /*J*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  499.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
  500.           0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
  501.   /*K*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  502.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
  503.           0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
  504.   /*L*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
  505.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  506.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  507.   /*M*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  508.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
  509.           0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
  510.   /*N*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  511.           0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
  512.           0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
  513.   /*O*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  514.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  515.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  516.   /*P*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  517.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
  518.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  519.   /*Q*/  {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
  520.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  521.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  522.   /*R*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  523.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
  524.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  525.   /*S*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  526.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
  527.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  528.   /*T*/  {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
  529.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  530.           0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
  531.   /*U*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  532.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  533.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  534.   /*V*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
  535.           0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
  536.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  537.   /*W*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
  538.           0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
  539.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  540.   /*X*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  541.           0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
  542.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
  543.   /*Y*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  544.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
  545.           0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
  546.   /*Z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  547.           0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  548.           0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
  549.   /*[*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
  550.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
  551.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
  552.   /*\*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
  553.           0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
  554.           0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
  555.   /*]*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
  556.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
  557.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
  558.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  559.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  560.           0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
  561.   /*_*/  {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  562.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  563.           000000,000000,000000,000000,000000,000000,000000},
  564.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  565.           000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
  566.           0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
  567.   /*a*/  {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
  568.           0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
  569.           0x03f8,000000,000000,000000,000000,000000,000000},
  570.   /*b*/  {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
  571.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  572.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  573.   /*c*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  574.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
  575.           0x03f8,000000,000000,000000,000000,000000,000000},
  576.   /*d*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  577.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  578.           0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
  579.   /*e*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
  580.           0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
  581.           0x03f8,000000,000000,000000,000000,000000,000000},
  582.   /*f*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  583.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
  584.           0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
  585.   /*g*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
  586.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  587.           0x13f8,000000,000000,000000,000000,000000,000000},
  588.   /*h*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  589.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  590.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  591.   /*i*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  592.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
  593.           000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
  594.   /*j*/  {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
  595.           0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
  596.           000000,000000,000000,0x0700,0x0700,0x0700,000000},
  597.   /*k*/  {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
  598.           0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
  599.           0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
  600.   /*l*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  601.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  602.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
  603.   /*m*/  {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
  604.           0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
  605.           0x0209,000000,000000,000000,000000,000000,000000},
  606.   /*n*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  607.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  608.           0x03f9,000000,000000,000000,000000,000000,000000},
  609.   /*o*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  610.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
  611.           0x03f8,000000,000000,000000,000000,000000,000000},
  612.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
  613.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  614.           0x03f9,000000,000000,000000,000000,000000,000000},
  615.   /*q*/  {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
  616.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  617.           0x13f8,000000,000000,000000,000000,000000,000000},
  618.   /*r*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  619.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
  620.           0x03f9,000000,000000,000000,000000,000000,000000},
  621.   /*s*/  {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
  622.           0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
  623.           0x07f8,000000,000000,000000,000000,000000,000000},
  624.   /*t*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
  625.           0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  626.           0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  627.   /*u*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  628.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  629.           0x1001,000000,000000,000000,000000,000000,000000},
  630.   /*v*/  {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
  631.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
  632.           0x1001,000000,000000,000000,000000,000000,000000},
  633.   /*w*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
  634.           0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  635.           0x1001,000000,000000,000000,000000,000000,000000},
  636.   /*x*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
  637.           0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
  638.           0x1001,000000,000000,000000,000000,000000,000000},
  639.   /*y*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
  640.           0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  641.           0x1001,000000,000000,000000,000000,000000,000000},
  642.   /*z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
  643.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  644.           0x1fff,000000,000000,000000,000000,000000,000000},
  645.   /*{*/  {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
  646.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
  647.           0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
  648.   /*|*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  649.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
  650.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  651.   /*}*/  {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
  652.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
  653.           0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
  654.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  655.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  656.           0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
  657.   /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
  658.           0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
  659.           0x1249,000000,000000,0x1249,000000,000000,0x1249},
  660. };
  661.  
  662. /*
  663. ** The plotting area is defined as a huge bitmap.
  664. ** The bitmap is stored in a dynamically allocated pixel array b_p
  665. **
  666. ** The bitmap is allocated (and initialized to zero) with
  667. ** b_makebitmap(xsize, ysize, planes)
  668. ** and freed with b_freebitmap()
  669. ** xsize and ysize will be rounded up to a multiple of 8.
  670. **
  671. ** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
  672. **
  673. ** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
  674. ** where the point (x,y) is the target to go from the current point
  675. ** To set the color use b_setvalue(value) where value is the value 
  676. ** (0 or 1 or a color number) to be stored in every pixel.
  677. ** To get dotted line styles, use b_setlinetype(linetype).
  678. **
  679. ** Internally all plotting goes through b_setpixel(x, y, value).
  680. */
  681.  
  682.  
  683. /*
  684. ** set pixel (x, y, value) to value value (this can be 1/0 or a color number).
  685. */
  686. void
  687. b_setpixel(x, y, value)
  688. unsigned int x, y, value;
  689. {
  690.   register unsigned int row;
  691.   register unsigned char mask;
  692.   int i;
  693.   if (b_rastermode) {
  694.     /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
  695.     row = x;  /* temp storage */
  696.     x = y;
  697.     y = b_ysize-1-row;
  698.   }
  699.   if (IN(x, b_xsize) && IN(y, b_ysize))
  700.   {
  701.     row = y/8;
  702.     mask = 1<<(y%8);
  703.  
  704.     for (i=0; i<b_planes; i++) {
  705.         if (value&1)
  706.             *((*b_p)[row]+x) |= mask;
  707.         else
  708.             *((*b_p)[row]+x) &= ~mask;
  709.         row += b_psize;
  710.         value >>= 1;
  711.     }
  712.   }
  713. #ifdef BITMAPDEBUG
  714.   else
  715.   {
  716.     if (b_rastermode)
  717.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n", 
  718.         b_ysize-1-y, x, value);
  719.     else
  720.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
  721.         x, y, value);
  722.   }
  723. #endif
  724. }
  725.  
  726. /*
  727. ** get pixel (x,y) value----unused
  728. */
  729. /****************************
  730. unsigned int
  731. b_getpixel(x, y)
  732. unsigned int x, y;
  733. {
  734.   register unsigned int row;
  735.   register unsigned char mask;
  736.   register unsigned char value;
  737.   int i;
  738.  
  739.   if (b_rastermode) {
  740.     row = x;
  741.     x = y;
  742.     y = b_ysize-1-row;
  743.   }
  744.   if (IN(x, b_xsize) && IN(y, b_ysize))
  745.   {
  746.     row = y/8 + (b_planes-1)*b_psize;
  747.     mask = 1<<(y%8);
  748.  
  749.     for (i=0; i<b_planes; i++) {
  750.         if ( *((*b_p)[row]+x) & mask )
  751.             value |= 1;
  752.         row -= b_psize;
  753.         value <<= 1;
  754.     }
  755.     return(value);
  756.   }
  757.   else
  758.   {
  759. #ifdef BITMAPDEBUG
  760.     if (b_rastermode)
  761.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
  762.         b_ysize-1-y, x);
  763.     else
  764.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
  765. #endif
  766.     return(0);
  767.   }
  768. }
  769. ********************************/
  770.  
  771. /*
  772. ** allocate the bitmap
  773. */
  774. void
  775. b_makebitmap(x, y, planes)
  776. unsigned int x, y, planes;
  777. {
  778.   register unsigned j;
  779.   unsigned rows;
  780.  
  781.   x = 8 * (unsigned int)(x/8.0+0.9);    /* round up to multiple of 8 */
  782.   y = 8 * (unsigned int)(y/8.0+0.9);    /* round up to multiple of 8 */
  783.   b_psize = y/8;                    /* size of each plane */
  784.   rows = b_psize * planes;            /* total number of rows of 8 pixels high */
  785.   b_xsize = x; b_ysize = y;
  786.   b_currx = b_curry = 0;
  787.   b_planes = planes;
  788.   b_value = 1;
  789.   b_angle = 0;
  790.   b_rastermode = 0;
  791.   /* allocate row pointers */
  792.   b_p = (bitmap *)alloc( rows * sizeof(pixels *), "bitmap row buffer");
  793.   bzero(b_p, rows * sizeof(pixels *));
  794.   for (j = 0; j < rows; j++) {
  795.     /* allocate bitmap buffers */
  796.     (*b_p)[j] = (pixels *)alloc(x * sizeof(pixels),(char *)NULL);
  797.     if ((*b_p)[j] == (pixels *)NULL) {
  798.         b_freebitmap();  /* free what we have already allocated */
  799.         int_error("out of memory for bitmap buffer", NO_CARET);
  800.     }
  801.     bzero((*b_p)[j], x * sizeof(pixels));
  802.   }
  803. }
  804.   
  805. /*
  806. ** free the allocated bitmap
  807. */
  808. void
  809. b_freebitmap()
  810. {
  811.   int j;
  812.   unsigned rows;
  813.  
  814.   rows = b_psize * b_planes;   /* total number of rows of 8 pixels high */
  815.   for (j = 0; j < rows; j++)
  816.   {
  817.     (void) free((char *)(*b_p)[j]);
  818.   }
  819.   (void) free((char *)b_p);
  820.   b_p = (bitmap *)(NULL);
  821. }
  822.  
  823. /*
  824. ** set pixel at (x,y) with color b_value and dotted mask b_linemask.
  825. */
  826. void
  827. b_setmaskpixel(x,y,value)
  828. unsigned int x,y,value;
  829. {
  830.     /* dotted line generator */
  831.     if ((b_linemask>>b_maskcount)&(unsigned int)(1)) {
  832.         b_setpixel(x,y,value);
  833.     }
  834.     b_maskcount= (b_maskcount+1) % 16;
  835.     b_lastx= x;  /* last pixel set with mask */
  836.     b_lasty= y;
  837. }
  838.  
  839. /*
  840. ** draw a line from (x1,y1) to (x2,y2)
  841. ** with color b_value and dotted mask b_linemask.
  842. */
  843. void
  844. b_line(x1,y1,x2,y2)
  845. unsigned int x1,y1,x2,y2;
  846. {
  847. int runcount;
  848. int dx,dy;
  849. int xinc,yinc;
  850. unsigned int xplot,yplot;
  851.  
  852.     runcount=0;
  853.     dx = abs((int)(x1)-(int)(x2));
  854.     if (x2>x1)  xinc=  1;
  855.     if (x2==x1) xinc=  0;
  856.     if (x2<x1)  xinc= -1;
  857.     dy = abs((int)(y1)-(int)(y2));
  858.     if (y2>y1)  yinc=  1;
  859.     if (y2==y1) yinc=  0;
  860.     if (y2<y1)  yinc= -1;
  861.     xplot=x1;
  862.     yplot=y1;
  863.     if (dx>dy) {
  864.         /* iterate x */
  865.         if ( (b_linemask==0xffff) ||
  866.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  867.             b_setmaskpixel(xplot,yplot,b_value);
  868.         while (xplot!=x2) {
  869.             xplot+=xinc;
  870.             runcount+=dy;
  871.             if (runcount>=(dx-runcount)) {
  872.                 yplot+=yinc;
  873.                 runcount-=dx;
  874.             }
  875.             b_setmaskpixel(xplot,yplot,b_value);
  876.         }
  877.     } else {
  878.         /* iterate y */
  879.         if ( (b_linemask==0xffff) ||
  880.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  881.             b_setmaskpixel(xplot,yplot,b_value);
  882.         while (yplot!=y2) {
  883.             yplot+=yinc;
  884.             runcount+=dx;
  885.             if (runcount>=(dy-runcount)) {
  886.                 xplot+=xinc;
  887.                 runcount-=dy;
  888.             }
  889.             b_setmaskpixel(xplot,yplot,b_value);
  890.         }
  891.     }
  892. }
  893.  
  894. /*
  895. ** set character size
  896. */
  897. void
  898. b_charsize(size)
  899. unsigned int size;
  900. {
  901.     int j;
  902.     switch(size) {
  903.         case FNT5X9:
  904.             b_hchar = FNT5X9_HCHAR;
  905.             b_hbits = FNT5X9_HBITS;
  906.             b_vchar = FNT5X9_VCHAR;
  907.             b_vbits = FNT5X9_VBITS;
  908.             for (j = 0; j < FNT_CHARS; j++ )
  909.                 b_font[j] = &fnt5x9[j][0];
  910.             break;
  911.         case FNT9X17:
  912.             b_hchar = FNT9X17_HCHAR;
  913.             b_hbits = FNT9X17_HBITS;
  914.             b_vchar = FNT9X17_VCHAR;
  915.             b_vbits = FNT9X17_VBITS;
  916.             for (j = 0; j < FNT_CHARS; j++ )
  917.                 b_font[j] = &fnt9x17[j][0];
  918.             break;
  919.         case FNT13X25:
  920.             b_hchar = FNT13X25_HCHAR;
  921.             b_hbits = FNT13X25_HBITS;
  922.             b_vchar = FNT13X25_VCHAR;
  923.             b_vbits = FNT13X25_VBITS;
  924.             for (j = 0; j < FNT_CHARS; j++ )
  925.                 b_font[j] = &fnt13x25[j][0];
  926.             break;
  927.         default:
  928.             int_error("Unknown character size",NO_CARET);
  929.     }
  930. }
  931.  
  932.  
  933. /*
  934. ** put characater c at (x,y) rotated by angle with color b_value.
  935. */
  936. void
  937. b_putc(x,y,c,angle)
  938. unsigned int x,y;
  939. char c;
  940. unsigned int angle;
  941. {
  942.     unsigned int i, j, k;
  943.     char_row fc;
  944.  
  945.     j = c - ' ';
  946.     for ( i = 0; i < b_vbits; i++ ) {
  947.         fc = *( b_font[j] + i );
  948.         if ( c == '_' ) {    /* treat underline specially */
  949.             if ( fc  ) {    /* this this the underline row ? *?
  950.                 /* draw the under line for the full h_char width */
  951.                 for ( k = ( b_hbits - b_hchar )/2;
  952.                     k < ( b_hbits + b_hchar )/2; k++ ) {
  953.                     switch(angle) {
  954.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  955.                             break;
  956.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  957.                             break;
  958.                     }
  959.                 }
  960.             }
  961.         }
  962.         else {
  963.             /* draw character */
  964.             for ( k = 0; k < b_hbits; k++ ) {
  965.                 if ( ( fc >> k ) & 1 ) {
  966.                     switch(angle) {
  967.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  968.                             break;
  969.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  970.                             break;
  971.                     }
  972.                 }
  973.             }
  974.         }
  975.     }
  976. }
  977.  
  978.  
  979. /*
  980. ** set b_linemask to b_pattern[linetype]
  981. */
  982. int
  983. b_setlinetype(linetype)
  984. int linetype;
  985. {
  986.     if (linetype>=7)
  987.         linetype %= 7;
  988.     b_linemask = b_pattern[linetype+2];
  989.     b_maskcount=0;
  990. }
  991.  
  992. /*
  993. ** set b_value to value
  994. */
  995. void
  996. b_setvalue(value)
  997. unsigned int value;
  998. {
  999.     b_value = value;
  1000. }
  1001.  
  1002. /*
  1003. ** move to (x,y)
  1004. */
  1005. int
  1006. b_move(x, y)
  1007. unsigned int x, y;
  1008. {
  1009.   b_currx = x;
  1010.   b_curry = y;
  1011. }
  1012.  
  1013. /*
  1014. ** draw to (x,y) with color b_value
  1015. */
  1016. int
  1017. b_vector(x, y)
  1018. unsigned int x, y;
  1019. {
  1020.   b_line(b_currx, b_curry, x, y);
  1021.   b_currx = x;
  1022.   b_curry = y;
  1023. }
  1024.  
  1025.  
  1026. /*
  1027. ** put text str at (x,y) with color b_value and rotation b_angle
  1028. */
  1029. int
  1030. b_put_text(x,y,str)
  1031. unsigned int x, y;
  1032. char *str;
  1033. {
  1034.     if (b_angle == 1)
  1035.         x += b_vchar/2;
  1036.     else
  1037.         y -= b_vchar/2;
  1038.    switch (b_angle) {
  1039.       case 0:
  1040.      for (; *str; ++str, x += b_hchar)
  1041.         b_putc (x, y, *str, b_angle);
  1042.                     break;
  1043.       case 1:
  1044.      for (; *str; ++str, y += b_hchar)
  1045.         b_putc (x, y, *str, b_angle);
  1046.                     break;
  1047.     }
  1048. }
  1049.  
  1050.  
  1051. int
  1052. b_text_angle(ang)
  1053. int ang;
  1054. {
  1055.     b_angle=(unsigned int)ang;
  1056.     return TRUE;
  1057. }
  1058.